<?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Auth;
use App\Http\Resources\Notification as NotificationCollection;
use Illuminate\Support\Facades\Input;


class NotificationsController extends Controller
{

    public function __construct()
    {
        $this->middleware('auth:api');
    }

    public function index(){


        $limit = Input::get('limit') ?: 20;
        $user = Auth::user();

        $notifications = $user->notifications()->paginate($limit);

        return NotificationCollection::collection($notifications);

    }
}
